-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix issue688: Make maxParamByteSize configurable in ParamFlowRequestDataWriter of cluster client module #823
Conversation
using the LongAdder rather than AtomicInteger to Provides better performance
merge master
sentinel-core/src/main/java/com/alibaba/csp/sentinel/config/SentinelConfig.java
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #823 +/- ##
============================================
- Coverage 41.75% 41.67% -0.08%
+ Complexity 1377 1375 -2
============================================
Files 304 305 +1
Lines 8764 8775 +11
Branches 1182 1184 +2
============================================
- Hits 3659 3657 -2
- Misses 4660 4672 +12
- Partials 445 446 +1
Continue to review full report at Codecov.
|
I add ClusterSentinelConfig class which dedicated to reading startup configurations of cluster client |
* @author lianglin | ||
* @since 1.7.0 | ||
*/ | ||
public class ClusterSentinelConfig { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name ClusterSentinelConfig
might be confusing... How about ClusterClientStartupConfig
or other else better?
for (Object param : entity.getParams()) { | ||
encodeValue(param, target); | ||
Object[] array = params.toArray(); | ||
for (int index = 0; index < amount; index++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some problems. Assume the parameter type list is [double, float, SomePojo, int]
, the customized SomePojo
object will be ignored so the calculated amount will be 3. Then if we use [0..2]
as the index to encode values, the third int
value would be lost. Maybe we need a List<Object> resolveValidParams(Collection<Object> params)
method (could be refactored from calculateParamTransportSize
method) , then we could get the amount and all values in order from the method.
And could you please update the test cases in |
emm, good suggestion. |
I lack some considerations.... |
the latest code had commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Nice work, thanks for contributing! |
Describe what this PR does / why we need it
Does this pull request fix one issue?
fix: #688
Describe how you did it
1、maxParamByteSize take effect :
when serialize parameters, use the return value of
calculateParamAmount() as the numbers that parameters can be written.
2、make the maxParamByteSize configurable:
add property: csp.sentinel.cluster.max.param.byte.size in SentinelConfig class
in DefaultClusterClientInitFunc class, when invoke initDefaultEntityWriters() method, read from Sentinel to get the property
Describe how to verify it
run in cluster model,and configure the csp.sentinel.cluster.max.param.byte.size. Observe whether the configuration takes effect。and i add some log when the params size over head the configure size.